<?php if($do_excel):?><html xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
    <!--[if gte mso 9]>
    <xml>
        <x:ExcelWorkbook>
            <x:ExcelWorksheets>
                <x:ExcelWorksheet>
                    <x:Name>Sheet 1</x:Name>
                    <x:WorksheetOptions>
                        <x:Print>
                            <x:ValidPrinterInfo/>
                        </x:Print>
                    </x:WorksheetOptions>
                </x:ExcelWorksheet>
            </x:ExcelWorksheets>
        </x:ExcelWorkbook>
    </xml>
    <![endif]-->
</head>
<?php endif?>
<?php if(!$do_excel):?><!doctype HTML>

<html>
<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/grocery_crud/css/font-awesome.min.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/grocery_crud/css/ui/simple/jquery-ui-1.10.1.custom.min.css">
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery-1.10.2.min.js"></script>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/grocery_crud/css/app.css">
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.core.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.widget.min.js"></script>

	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.button.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.menu.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.slider.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url()?>assets/grocery_crud/js/jquery_plugins/ui/minified/jquery.ui.datepicker.min.js"></script>
	
</head>
<body>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/grocery_crud/css/app.css">
<style type="text/css">
body,
table.tbl-lap th,table.tbl-lap td{
	font-family: DroidSans;
	font-size: 11px;
}
table.tbl-lap{
	border-collapse: collapse;
}
table.tbl-lap th{
	padding: 1em;
}
table.tbl-lap th, .no{
	background: #ccc;
}
</style>
<?php
$center = 'align="center" valign="top"';
?>	<style type="text/css">
body{
	font-size: 12px;
	font-family: DroidSans;
}
.t{
	text-align: center;
}
#nama_field_box{
	width: 420px !important;
	margin:2px auto;
	width: 370px; 
}

#pagination{
	

	border: 1px solid #000;
    height: 25px;
    padding: 4px;
    text-align: center !important;
  /*  width: 400px;*/
    border-radius: 2px;
    background: #cecece;
}
	</style>

<h3 class="t"><i class="fa fa-print"></i>&nbsp;CETAK</h3>
<form method="post" action="<?php echo site_url('cetak/main')?>">	
<div id="nama_field_box" class="form-field-box odd">
<input type="hidden" name="do_cetak" value="YES"/>
<input type="hidden" name="do_excel" value="NO"/>	
	<div id="nama_input_box" class="form-input-box">
		<label>Periode :</label>&nbsp;<input type="text" maxlength="100" value="<?php echo $param[dt_start]?>" name="dt_start" id="field-dt_start"/>
		S/D
		<input type="text" maxlength="100" value="<?php echo $param[dt_end]?>" name="dt_end" id="field-dt_end">
	</div>
	<div class="clear"></div>
</div>
<br/>
<div id="rsCount" style="width:400px;margin:0 auto;margin-left:45%;color:green;display:none"></div>
<br/>
<div style="text-align:center">
	<input disabled type="submit" value="Tampilkan" id="tampil"/><input disabled id="excel" type="submit" value="Export Excel"/><input id="atur" type="reset" value="Atur Ulang"/>
</div>
</form>
<br/>
<?php if(!empty($pgn)):?>
<div class="pgn" id="pagination">
<?php echo $pgn?>
<div style="clear:both"></div>
</div>
<?php endif;?>
<div class="lap-view">
<?php endif ?>
<table width="100%"  border="1" class="tbl-lap" cellpadding="4" colspacing="4">
		<thead>
			<tr>
				<th nowrap="nowrap">No.</th>
				<th nowrap="nowrap">Importer</th>
				<th nowrap="nowrap">Import Permit</th>
				<th nowrap="nowrap">COI No.</th>
				<th nowrap="nowrap">Date</th>
				<th nowrap="nowrap">Port Of Loading</th>
				<th nowrap="nowrap">Port Of Discharge</th>
				<th nowrap="nowrap">Description Of Goods</th>
				<th nowrap="nowrap">HS Code</th>
				<th colspan="2" nowrap="nowrap">QTY</th>
			
				<th colspan="2" nowrap="nowrap">Value</th>
				<th nowrap="nowrap">Kode Cabang</th>
				<th nowrap="nowrap">Alamat Importir</th>
				<th nowrap="nowrap">Telp Importir</th>
				<th nowrap="nowrap">NPWP</th>
				<th nowrap="nowrap">No. API</th>
				<th nowrap="nowrap">Nama Eksportir</th>
				<th nowrap="nowrap">Alamat Eksportir</th>
				<th nowrap="nowrap">Alamat Pemeriksaan</th>
				<th nowrap="nowrap">Tanggal Periksa</th>
				<th nowrap="nowrap">Biaya Pemeriksaan</th>
				<th nowrap="nowrap">Permit Expired</th>
				<th nowrap="nowrap">Negara Pembuat</th>
				<th nowrap="nowrap">No. Quotation Letter</th>
				<th nowrap="nowrap">No. Inspection Order</th>
			</tr>
		</thead>
		<tbody>
			<?php $no = $num+1; ?>
			<?php foreach($rs->result() as $line):?>
			
			<tr>
				<td align="center" class="no" nowrap="nowrap"><?php echo $no++;?></td>
				<td nowrap="nowrap"><?php echo $line->Importir ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->Nomor_Izin_Impor ?></td>
				<td nowrap="nowrap"><?php echo $line->Nomor_COI ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->Tanggal_COI ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->Kode_Negara_Muat ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->Kode_Pelabuhan_Tujuan ?></td>
				<td nowrap="nowrap"><?php echo $line->Deskripsi_Barang ?></td>
				<td nowrap="nowrap"><?php echo $line->HS ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->Jumlah ?></td>
				<td nowrap="nowrap"><?php echo $line->Satuan ?></td>
				<td nowrap="nowrap"><?php echo "USD" ?></td>
				<td nowrap="nowrap"><?php echo $line->nilai_usd ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->Kode_Cabang ?></td>
				<td nowrap="nowrap"><?php echo $line->Alamat_Importir ?></td>
				<td nowrap="nowrap"><?php echo $line->Telp_Importir ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->NPWP ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->Nomor_API ?></td>
				<td nowrap="nowrap"><?php echo $line->Eksportir ?></td>
				<td nowrap="nowrap"><?php echo $line->Alamat_Eksportir ?></td>
				<td nowrap="nowrap"><?php echo $line->Alamat_Pemeriksaan ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->Tanggal_Periksa ?></td>
				<td nowrap="nowrap"><?php echo $line->Biaya_Periksa ?></td>
				<td nowrap="nowrap"><?php echo $line->Tanggal_Izin_Impor_Exp ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->negara_pembuat ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->ql_no ?></td>
				<td align="center" nowrap="nowrap"><?php echo $line->io_no ?></td>
			</tr>
			<?php endforeach;?>	
		</tbody>
	</table>
<?php if(!$do_excel):?>	
</div>
<?php if(!empty($pgn)):?>
<div class="pgn" id="pagination">
<?php echo $pgn?>
<div style="clear:both"></div>
</div>
<?php endif ?>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
	$('#field-dt_start').datepicker({dateFormat: 'dd/mm/yy',changeYear:true,changeMonth:true});
	$('#field-dt_end').datepicker({dateFormat: 'dd/mm/yy',changeYear:true,changeMonth:true});


	$('#field-dt_start,#field-dt_end').change(function(){
		var dt_start = $('#field-dt_start').val();
		var dt_end = $('#field-dt_end').val();
		

		if(dt_start.length && dt_end.length ){
			$('#rsCount').text('Calculating ......').show();
			$.post('<?php echo base_url()?>cetak/count',{'dt_start':dt_start,'dt_end':dt_end},function(r){
				$('#rsCount').html('Total records : <b>' + r + '</b> item.');
				if(parseInt(r) > 0)
					$('#tampil,#excel').removeAttr('disabled');
				else
					$('#tampil,#excel').attr('disabled','disabled');
			});
			
		}else{
			$('#tampil,#excel').attr('disabled','disabled');

		}
	}).change();

	$('#atur').click(function(){
		$('#tampil,#excel').attr('disabled','disabled');
		$('#rsCount').hide('');
		$('#field-dt_start').val('');
		$('#field-dt_end').val('');
	});

	$('#excel').click(function(){
		$('input[name=do_excel]').val('YES');
		return true;
	})
	$('#tampil').click(function(){
		$('input[name=do_excel]').val('NO');
		return true;
	})
});
</script>
<?php endif?>